﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using ArcEngine.Resources;
using System.Text;
using System.Windows.Forms;

namespace ArcEngine.Editor.Wizards
{
	public partial class NewTileSetWizard : Form
	{

		/// <summary>
		/// 
		/// </summary>
		public NewTileSetWizard()
		{
			InitializeComponent();

			foreach (string name in ResourceManager.GetTextures())
			{
				TextureBox.Items.Add(name);
			}
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void NewTileSetWizard_FormClosing(object sender, FormClosingEventArgs e)
		{
			if (DialogResult != DialogResult.OK)
				return;

			// TileSet already exists ?
			if (ResourceManager.GetTileSet(TileSetNameBox.Text) != null || TileSetNameBox.Text == "")
			{
				MessageBox.Show("TileSet name already in use or invalid. Use another name !");
				e.Cancel = true;
				return;
			}



			// Create the level
			TileSet tileset = ResourceManager.CreateTileSet(TileSetNameBox.Text);
			if (tileset != null)
				tileset.TextureName = (string)TextureBox.SelectedItem;

		}





	}
}
